<script setup>
import { ref } from 'vue'
import API from '../plugins/axios'
import { useRouter } from 'vue-router'


const item = ref(['hello', "world", "how", "you"])
const router = useRouter()
const toHome = (()=>{
  router.push({
    path: '/home'
  })
})
const getData = () => {
  API({
    url: '/get/data',
    method: 'get'
  }).then((res) => {
    console.log("success", res)
  });
}

</script>

<template>
  <el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>答题卡</span>
        <el-button class="button" text @click="getData">换一题</el-button>
        <el-button class="button" text @click="toHome">跳到Home</el-button>
      </div>
    </template>
    <div v-for="(e, i) in item" :key="i" class="text item">{{ 'A.' + e }}</div>
  </el-card>
</template>

<style>
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  width: 480px;
}
</style>
